@extends('layouts.admin')
@section('content')
    @include('admin.nav')
    <form action="{{route('site.admin.roleUpdate',[$site,$user])}}" method="post">
        @csrf
        @method('put')
        <div class="card">
            <div class="card-header">
                为{{$user->name}}设置角色
            </div>
            <div class="card-body">
                <div class="d-flex align-items-center">
                    @foreach($site->roles as $role)
                        <label class="mr-2 mb-0">
                            <input type="checkbox" name="roles[]" value="{{$role->id}}" {{$user->hasRole($role)? 'checked' : ''}}>
                            {{$role->title}}
                        </label>
                        <a href="{{route('site.permission.edit',[$site,$role])}}" class="small mr-4">查看权限</a>

                    @endforeach
                </div>

            </div>
            <div class="card-footer text-muted">
                <button class="btn btn-info">保存</button>
            </div>
        </div>
    </form>
@endsection
